using Gateway.Common.Extensions;
using SqlSugar;

namespace Gateway.IQuery.UploadFiles.Result;

/// <summary>
/// 上传文件详情
/// </summary>
[SugarTable("UploadFiles")]
public class UploadFilesDetailResult : BaseResult
{
    /// <summary>
    /// 文件标识
    /// </summary>
    public string UploadFilesId { get; set; }
    /// <summary>
    /// 文件号
    /// </summary>
    public string FileNo { get; set; }

    /// <summary>
    /// 文件大小
    /// </summary>
    public long Length { get; set; }

    /// <summary>
    /// 大小格式化
    /// </summary>
    public string SizeFormat
    {
        get
        {
            return Length.ToHumanReadableSize();
        }
    }

    /// <summary>
    /// 文件扩展信息
    /// </summary>
    public string ExtInfo { get; set; }

    /// <summary>
    /// 文件hash
    /// </summary>
    public string Hash { get; set; }

    /// <summary>
    /// 完整存储路径
    /// </summary>
    public string Path { get; set; }

    /// <summary>
    /// 原文件名
    /// </summary>
    public string OriginName { get; set; }

    /// <summary>
    /// 后缀
    /// </summary>
    public string Suffix  => string.IsNullOrEmpty(Path) ? "" : System.IO.Path.GetExtension(Path);

    /// <summary>
    /// 完整的路径
    /// </summary>
    public string Url { get; set; }
    /// <summary>
    /// 是否是临时文件
    /// </summary>
    public bool IsTemp { get; set; }

    /// <summary>
    /// 存储来源 local 本地 其他的归属为 oss 的 key
    /// </summary>
    public string StorageKey { get; set; }
}